﻿@model UPSShippingModel

@using Nop.Plugin.Shipping.UPS.Domain
@using Nop.Plugin.Shipping.UPS.Models

@{
    Layout = "_ConfigurePlugin";
}

<form asp-controller="UPSShipping" asp-action="Configure" method="post">
    <script>
        $(document).ready(function () {
            $("#PackingType").change(togglePackingType);
            togglePackingType();
        });

        function togglePackingType() {
            var selectedPackingTypeId = $("#PackingType").val();
            if (selectedPackingTypeId == @((int)PackingType.PackByDimensions)) {
                $('#pnlPassDimensions').show();
                $('#pnlPackingPackageVolume').hide();
            }
            else if (selectedPackingTypeId == @((int)PackingType.PackByOneItemPerPackage)) {
                $('#pnlPassDimensions').hide();
                $('#pnlPackingPackageVolume').hide();
            }
            else if (selectedPackingTypeId == @((int)PackingType.PackByVolume)) {
                $('#pnlPassDimensions').hide();
                $('#pnlPackingPackageVolume').show();
            }
        }
    </script>

    <div class="panel-group">
        <div class="panel panel-default">
            <div class="panel-body">
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="UseSandbox" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="UseSandbox" />
                        <span asp-validation-for="UseSandbox"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="AccountNumber" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="AccountNumber" />
                        <span asp-validation-for="AccountNumber"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="AccessKey" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="AccessKey" />
                        <span asp-validation-for="AccessKey"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="Username" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="Username" />
                        <span asp-validation-for="Username"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="Password" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="Password" />
                        <span asp-validation-for="Password"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="CustomerClassification" />
                    </div>
                    <div class="col-md-9">
                        <nop-select asp-for="CustomerClassification" asp-items="Model.AvailableCustomerClassifications" />
                        <span asp-validation-for="CustomerClassification"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="PickupType" />
                    </div>
                    <div class="col-md-9">
                        <nop-select asp-for="PickupType" asp-items="Model.AvailablePickupTypes" />
                        <span asp-validation-for="PickupType"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="PackagingType" />
                    </div>
                    <div class="col-md-9">
                        <nop-select asp-for="PackagingType" asp-items="Model.AvailablePackagingTypes" />
                        <span asp-validation-for="PackagingType"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="InsurePackage" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="InsurePackage" />
                        <span asp-validation-for="InsurePackage"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="AdditionalHandlingCharge" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="AdditionalHandlingCharge" />
                        <span asp-validation-for="AdditionalHandlingCharge"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="AvailableCarrierServices" />
                    </div>
                    <div class="col-md-9">
                        @foreach (var service in Model.AvailableCarrierServices)
                        {
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="@(nameof(Model.CarrierServices))" value="@(service.Value)" checked="@(service.Selected)" />
                                    @(service.Text)
                                </label>
                            </div>
                        }
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="SaturdayDeliveryEnabled" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="SaturdayDeliveryEnabled" />
                        <span asp-validation-for="SaturdayDeliveryEnabled"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="PackingType" />
                    </div>
                    <div class="col-md-9">
                        <nop-select asp-for="PackingType" asp-items="Model.AvaliablePackingTypes" />
                        <span asp-validation-for="PackingType"></span>
                    </div>
                </div>
                <div class="form-group" id="pnlPassDimensions">
                    <div class="col-md-3">
                        <nop-label asp-for="PassDimensions" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="PassDimensions" />
                        <span asp-validation-for="PassDimensions"></span>
                    </div>
                </div>
                <div class="form-group" id="pnlPackingPackageVolume">
                    <div class="col-md-3">
                        <nop-label asp-for="PackingPackageVolume" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="PackingPackageVolume" />
                        <span asp-validation-for="PackingPackageVolume"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="WeightType" />
                    </div>
                    <div class="col-md-9">
                        <nop-select asp-for="WeightType" asp-items="Model.AvaliableWeightTypes" />
                        <span asp-validation-for="WeightType"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="DimensionsType" />
                    </div>
                    <div class="col-md-9">
                        <nop-select asp-for="DimensionsType" asp-items="Model.AvaliableDimensionsTypes" />
                        <span asp-validation-for="DimensionsType"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="Tracing" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="Tracing" />
                        <span asp-validation-for="Tracing"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-9 col-md-offset-3">
                        <input type="submit" name="save" class="btn bg-blue" value="@T("Admin.Common.Save")" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>